<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Displaying remote clients</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"/><LINK
REL="HOME"
TITLE="Cygwin/X User's Guide"
HREF="cygwin-x-ug.html"/><LINK
REL="UP"
TITLE="Using Cygwin/X"
HREF="using.html"/><LINK
REL="PREVIOUS"
TITLE="Shared memory support"
HREF="using-shared-memory.html"/><LINK
REL="NEXT"
TITLE="Remote sessions via XDMCP"
HREF="using-remote-session.html"/><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html;charset=utf-8"/></HEAD
><BODY
CLASS="sect1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Cygwin/X User's Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="using-shared-memory.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Using Cygwin/X</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="using-remote-session.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"/></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="using-remote-apps"
>Displaying remote clients</A
></H1
><P
>Displaying remote X clients with Cygwin/X is identical
to displaying remote X clients with any other X Server.</P
><P
>It is recommended that you use the secure method of tunnelling
the X connection over <B
CLASS="command"
>ssh</B
>.
</P
><P
>&#13;Alternatively, you can use the host-based access control provided by the
X server, connecting to the remote machine using <B
CLASS="command"
>telnet</B
> or
<B
CLASS="command"
>rsh</B
> and directing clients to connect to the server by setting
the DISPLAY environment variable.  This method is insecure and not recommended.</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="using-remote-apps-ssh"
>Secure ssh</A
></H2
><P
>On your Windows machine:</P
><OL
TYPE="1"
><LI
><P
>Make sure you have the <TT
CLASS="literal"
>openssh</TT
> package
installed.</P
></LI
><LI
><P
>Launch Cygwin/X</P
></LI
><LI
><P
>Ensure the DISPLAY environment variable is set correctly. (This step is not neccessary if you are entering your commands into an X terminal, as DISPLAY must already be set in that case)</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ export DISPLAY=<TT
CLASS="replaceable"
><I
>:0.0</I
></TT
>
</PRE
></TD
></TR
></TABLE
></LI
><LI
><P
>Run the <B
CLASS="command"
>ssh</B
> command to connect to the remote host:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ ssh -Y <TT
CLASS="replaceable"
><I
>username</I
></TT
>@<TT
CLASS="replaceable"
><I
>remote_hostname_or_ip_address</I
></TT
>
</PRE
></TD
></TR
></TABLE
></LI
><LI
><P
>Enter your password when prompted by
<B
CLASS="command"
>ssh</B
>.</P
></LI
><LI
><P
>Your <B
CLASS="command"
>ssh</B
> session should now show you a shell
prompt for your remote machine.</P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
The ssh server will automatically set the DISPLAY environment variable
appropriately, typically to something like <TT
CLASS="literal"
>localhost:10.0</TT
>,
so clients will connect to a proxy X11 display on the remote host from
which the X11 protocol will be forwarded over ssh to your X server.
</P
><P
>&#13;If your login scripts unconditionally set DISPLAY to something else,
this will break X11 forwarding.
</P
></BLOCKQUOTE
></DIV
></LI
><LI
><P
>You can now launch remote X clients in your
<B
CLASS="command"
>ssh</B
> session, for example:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ xterm &amp;
</PRE
></TD
></TR
></TABLE
><P
>&#13;will launch an xterm running on your
remote host that will display on your Cygwin/X screen.</P
></LI
><LI
><P
>Launch other remote clients in the same manner.  I recommend
starting the remote clients in the background, by appending
<TT
CLASS="literal"
>&amp;</TT
> to the command name, so that you don't have to
open several <B
CLASS="command"
>ssh</B
> sessions.</P
></LI
></OL
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>By default, the OpenSSH server does not allow forwarded X connections.
This must be configured on the remote host by adding <TT
CLASS="literal"
>X11Forwarding yes</TT
>
to the <TT
CLASS="filename"
>sshd_config</TT
> configuration file.
The OpenSSH server must be restarted or SIGHUP'ed to re-read the configuration
file after it is changed.
</P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
The OpenSSH server requires the <B
CLASS="command"
>xauth</B
> command to be available
to forward X connections. Consequently, it must be installed on the remote host.
</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="using-remote-apps-telnet"
>Insecure telnet or rsh (Not recommended)</A
></H2
><P
>An example of connecting remote clients using host-based authorization.</P
><P
>On your Windows machine:</P
><OL
TYPE="1"
><LI
><P
>Make sure you have the <TT
CLASS="literal"
>inetutils</TT
> package
installed (for <B
CLASS="command"
>telnet</B
>) or <TT
CLASS="literal"
>rsh</TT
> package
(for <B
CLASS="command"
>rsh</B
>).</P
></LI
><LI
><P
>Launch Cygwin/X</P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
You must provide the <CODE
CLASS="parameter"
>-listen tcp</CODE
> option to
<B
CLASS="command"
>startx</B
> or <B
CLASS="command"
>startxwin</B
> so that the X server
will listen for TCP/IP connections.
(See <A
HREF="../faq/cygwin-x-faq.html#q-remote-clients-cant-connect"
TARGET="_top"
>this FAQ
</A
> for more details).
</P
></BLOCKQUOTE
></DIV
></LI
><LI
><P
>In an X terminal, use the <B
CLASS="command"
>xhost</B
> command to allow the
remote host access to make connections to your X server:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ xhost <TT
CLASS="replaceable"
><I
>remote_hostname_or_ip_address</I
></TT
>
</PRE
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
>Run the <B
CLASS="command"
>telnet</B
> or <B
CLASS="command"
>rsh</B
> command to connect to the remote host:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ /usr/bin/telnet <TT
CLASS="replaceable"
><I
>remote_hostname_or_ip_address</I
></TT
>
</PRE
></TD
></TR
></TABLE
> or
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ rsh <TT
CLASS="replaceable"
><I
>remote_hostname_or_ip_address</I
></TT
>
</PRE
></TD
></TR
></TABLE
>
</P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>Use the explicit path to ensure that Cygwin's <B
CLASS="command"
>telnet</B
> is
run instead of Microsoft's <B
CLASS="command"
>telnet</B
>. Microsoft's
<B
CLASS="command"
>telnet</B
> cannot read input or display output correctly
when run from a Cygwin shell.</P
></BLOCKQUOTE
></DIV
></LI
><LI
><P
>Login to your remote machine</P
></LI
><LI
><P
>Ensure the DISPLAY environment variable is set correctly in your remote session.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ export DISPLAY=<TT
CLASS="replaceable"
><I
>windows_hostname_or_ip_address</I
></TT
>:0.0
</PRE
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
>You can now launch remote X clients in your
<B
CLASS="command"
>ssh</B
> session, for example:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13;$ xterm &amp;
</PRE
></TD
></TR
></TABLE
><P
>&#13;will launch an xterm running on your
remote host that will display on your Cygwin/X screen.</P
></LI
><LI
><P
>Launch other remote clients in the same manner. I recommend
starting the remote clients in the background, by appending
<TT
CLASS="literal"
>&amp;</TT
> to the command name, so that you don't have to
open several <B
CLASS="command"
>telnet</B
> or <B
CLASS="command"
>rsh</B
> sessions.</P
></LI
></OL
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
This is <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>insecure</I
></SPAN
> because (1) when you log in, your username
and password may be transmitted in clear across the network between you and the remote host
(2) the X protocol is transmitted in clear across the network between you and the
remote host, and (3) you have allowed any user on the remote host to connect to your
X server and monitor your X session.
For these reasons, use ssh forwarding, if at all possible.
</P
></BLOCKQUOTE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"/><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="using-shared-memory.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cygwin-x-ug.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="using-remote-session.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Shared memory support</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="using.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Remote sessions via XDMCP</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>